package vn.cent.game.cardtype.server;

import vn.cent.game.cardtype.main.CardTypeGameExtension;
import vn.cent.game.findnumberv2.main.FindNumberV2Extension;

import com.smartfoxserver.v2.core.ISFSEvent;
import com.smartfoxserver.v2.core.SFSEventParam;
import com.smartfoxserver.v2.entities.Room;
import com.smartfoxserver.v2.exceptions.SFSException;
import com.smartfoxserver.v2.extensions.BaseServerEventHandler;

public class RoomRemoved extends BaseServerEventHandler{

	@Override
	public void handleServerEvent(ISFSEvent evt) throws SFSException {

		// Get room that user has left
		Room room = (Room) evt.getParameter(SFSEventParam.ROOM);
		
		if(room == null){
			trace("RoomRemoveEventHandler: room is null");
			return;
		}
		
		if(room.isGame()){
			CardTypeGameExtension gameExt = (CardTypeGameExtension) getParentExtension();
			if(gameExt.getListGameBC().containsKey(room.getId())) {
				gameExt.getListGameBC().remove(room.getId());
			} 
		}
	}
}
